package com.YK.retryer.strategy.annotationwrapper.intervalwrapper;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;

/**
 * @author yuank
 * @version 1.0.0
 * @date 2025/2/28 14:56:39
 */
@Data
@Accessors(chain = true)
public abstract class AbstractTimeIntervalWrapper implements TimeValueWrapper, ThreadRetrySleepSuccess {

    //重试时间与单位
    protected int time;
    protected TimeUnit timeUnit;
    //最大重试次数-不需要重试就不会进行
    protected int maxAttempts;


    @Override
    public AbstractTimeIntervalWrapper setTimeIntervalValue(TimeUnit timeUnit, int time, int maxAttempts) {
        this.timeUnit = timeUnit;
        this.time = time;
        this.maxAttempts = maxAttempts;
        return this;
    }
}